﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common.Helper;
using EF.Container;
using IEFbll;

namespace EFdemo.Controllers
{
    public class LoginController : Controller
    {
        private ILoginService LoginService = Container.Resolve<ILoginService>();
        public ActionResult Login()
        {
            return View();
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        [HttpPost]
        public ActionResult LoginIn(string userName, string password)
        {
            if( LoginService.LoginOK( userName, password ) )
                return Content( new { state = true }.ToJson() );
            return Content( new { state = false }.ToJson() );
        }
    }
}